package org.tong.web2.cfg;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

/**
 * @author
 * @date 2022-10-08 14:54
 */
//@Configuration
public class Web2Cfg {

    @Value("${web2.spring.datasource.url}")
    private String jdbcUrl;

    @Value("${web2.spring.datasource.url}")
    private String username;

    @Value("${web2.spring.datasource.url}")
    private String password;

    @Value("${web2.flag:}")
    private String flag;

    @Bean
    public DataSource initDataSource() {
        HikariConfig config = new HikariConfig();
        config.setJdbcUrl(jdbcUrl);
        config.setUsername(username);
        config.setPassword(password);
        HikariDataSource hikariDataSource = new HikariDataSource(config);
        return hikariDataSource;
    }
}
